<div class="col-md-12">

<div class="portlet">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i><?= __('Điều kiện tìm kiếm'); ?>
        </div>
        <div class="actions">
        	<?php if(empty($this->data[$als])):?>
			<a href="#" class="btn btn-info _show"><i class="fa fa-angle-down"></i> <span><?= __('Hiển thị')?></span></a>
			<?php else: ?>
			<a href="#" class="btn btn-info _hide"><i class="fa fa-angle-up"></i> <span><?= __('Ẩn')?></span></a>
			<?php endif; ?>
		</div>
    </div>
    <div class="portlet-body form" <?= empty($this->data[$als]) ? 'style="display:none"' : '' ?>">
        <!-- BEGIN FORM-->
        <?php echo $this->Form->create($als, array('class' => 'form-horizontal')); ?>
        <?php echo $this->Form->hidden('action', array('value' => 'search'));  ?>

        <div class="form-body">
        	<div class="row">
				<div class="col-md-6">
					<div class="form-group">
						<label class="control-label col-md-3"><?= __('Tiêu đề'); ?></label>
						<div class="col-md-7">
							<?php echo $this->Form->text($als . '.title', array( 'required' => 'none', 'class' => 'form-control', 'label' => false, 'placeholder' => __('Nhập tiêu đề') )); ?>
						</div>
					</div>
				</div>
				<!--/span-->

				<div class="col-md-6">
					<div class="form-group">
						<label class="control-label col-md-3"><?= __('Tên gọi khác'); ?></label>
						<div class="col-md-7">
							<?php echo $this->Form->text($als . '.als', array( 'required' => 'none', 'class' => 'form-control', 'label' => false, 'placeholder' => __('Nhập tên gọi khác') )); ?>
						</div>
					</div>
				</div>
				<!--/span-->

				<div class="col-md-6">
					<div class="form-group">
						<label class="control-label col-md-3"><?= __('Trạng thái'); ?></label>
						<div class="col-md-7">
							<?php echo $this->Form->input($als . '.status', array( 'required' => 'none', 'class' => 'form-control', 'label' => false, 'options' => $status, 'empty' => __('-- Chọn trạng thái') )); ?>
						</div>
					</div>
				</div>
				<!--/span-->

			</div>
        </div>

        <div class="form-actions fluid">
            <div class="row">
				<div class="col-md-6">
					<div class="col-md-offset-3 col-md-9">
						<button type="submit" class="btn btn-info"><?= __('Tìm kiếm'); ?></button>
						<button type="button" class="btn btn-warning"><?= __('Xóa dự liệu tìm kiếm'); ?></button>
					</div>
				</div>
				<div class="col-md-6">
				</div>
			</div>
        </div>
        </form>
        <!-- END FORM-->
    </div>
</div>

<!-- BEGIN BORDERED TABLE PORTLET-->
<?php echo $this->Form->create($als); ?>
<?php echo $this->Form->hidden('action', array('value' => 'update'));  ?>
<div class="portlet">
	<div class="portlet-title">
		<div class="caption"> <i class="fa fa-cogs"></i><?= __('Danh Sách Tin Tức'); ?> </div>
		<div class="tools"> </div>
	</div>
	<div class="portlet-body">
		<div class="table-toolbar">
			<div class="btn-group mt5 mb5 adm-group-action">
				<?php echo $this->Form->hidden('status', array('value' => ''));  ?>
				<div class="btn-group">
	                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
	                    <span><?= __('-- chọn hành động --'); ?></span>
	                    <span class="caret"></span>
	                </button>
	                <ul class="dropdown-menu" role="menu">
	                    <li>
	                        <a href="#" data-type="action" data-status="9"><i class="fa fa-trash-o text-danger"></i> <?= __('Xóa mẫu tin được chọn'); ?></a>
	                    </li>
	                    <li>
	                        <a href="#" data-type="action" data-status="5"><i class="fa fa-lock text-danger"></i> <?= __('Khóa mẫu tin được chọn'); ?></a>
	                    </li>
	                    <li>
	                        <a href="#" data-type="action" data-status="4"><i class="fa fa-unlock text-success"></i> <?= __('Bỏ khóa mẫu tin được chọn'); ?></a>
	                    </li>
	                </ul>
	            </div>
	            <button type="submit" class="btn btn-danger" data-confirm="<?= __('Bạn có chắc chắn muốn đổi trạng thái những mẫu tin được chọn không?'); ?>" tabindex="-1"><?= __('Thực hiện'); ?></button>
			</div>

			<div class="btn-group pull-right mt5 mb5">
				<a href="<?= $this->webroot.'admin/news/add/' ?>" class="btn btn-success"> <?= __('Thêm mới')?> <i class="fa fa-plus"></i></a>
			</div>
		</div>

		<div class="table-responsive clearfix">
			<table class="table table-bordered table-hover mb5">
			<thead>
			<tr>
				<th style="width:18px"><input type="checkbox" class="select-all" /></th>
				<th><?= __('Ảnh đại diện');?></th>
				<th><?= __('Tiêu đề');?></th>
				<th><?= __('Tên goi khác');?></th>
				<th><?= __('Nội dung');?></th>
				<th><?= __('Trạng thái');?></th>
				<th></th>
			</tr>
			</thead>
			<tbody>
			<?php if(count($items) > 0):?>
			<?php foreach($items as $k => $v):?>
				<!-- Kiem tra quyen -->
	            <?php
	                $_class = '';
	                if($v[$als]['status'] == 9) {
	                    $_class = 'danger';
	                } elseif( $v[$als]['status'] == 5) {
	                    $_class = 'warning';
	                }
	            ?>

	            <tr class="<?= $_class; ?>">
					<td> <?php  echo $this->Form->checkbox('del.' . $v[$als]['id']); ?> </td>
					<td style="width:10%" align="center">
						<?php if(!empty($v[$als]['image'])): ?>
						<img alt="" src="<?php echo PUBLIC_THUMB_SHOW. $v[$als]['image'] ?>" style="width:80px;">
						<?php endif; ?>
					</td>
					<td>
						<a href="<?= $this->webroot . 'admin/news/info/' . $v[$als]['id'] ?>" class="tooltips tooltip-primary" data-placement="right" data-rel="tooltip" title="" data-original-title="Xem chi tiết"><?= $v[$als]['title']?></a>
					</td>
					<td><?php echo $v[$als]['als'];?></td>
					<td style="width:30%"><?php echo $v[$als]['desc'];?></td>
					<td style="width: 120px;"><?= @$status[$v[$als]['status']] ;?></td>
					<td align="center">
						<a href="<?= $this->webroot.'admin/news/add/' . $v[$als]['id'] ?>" class="tooltips tooltip-primary" data-placement="top" data-original-title="Sửa"><i class="fa fa-edit text-primary"></i></a>
					</td>
				</tr>
			<?php endforeach; endif;?>
			</tbody>
			</table>

			<?php $params = $this->Paginator->params(); if($params['pageCount'] > 1) :?>
				<div class="clearfix"></div>
				<?php echo $this->element('paging'); ?>
			<?php endif; ?>
		</div>
	</div>
</div>
<?php echo $this->Form->end(); ?>
<!-- END BORDERED TABLE PORTLET-->
</div>
